<%@ page language="java" import="weaver.general.Util" pageEncoding="UTF-8"%>
<jsp:useBean id="recordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="record" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>

<%

//�������ݵķֲ�ID�������ֲ����ݶ�ɾ��
int subcompanyid = Util.getIntValue(request.getParameter("subcompanyid"),-1);
rs.writeLog("��ʼ����ɾ���������ݽӿڣ���ηֲ� subcompanyid = "+subcompanyid);

if(subcompanyid > 0){

	try {
			String meetingids= "";
			//���ݷֲ���ȡ��Աid��Ȼ��ʹ����Աid��Ϊ�����˲�ѯ���飬��ȡ����id��ɾ��������Ϣ
			recordSet.executeQuery("select id from hrmresource where subcompanyid1 <> "+ subcompanyid);
			while (recordSet.next()) {
				String hrmid = recordSet.getString("id");

				record.executeQuery("select id from meeting where 1=1 and creater = ? ",hrmid);
				while (record.next()) {
					if("".equals(meetingids)){
						meetingids = record.getString("id");
					}else{
						meetingids += ","+record.getString("id");
					}
				}
				//�����ճ�idɾ���������ݺͲλ�������
				if(!"".equals(meetingids)){
					rs.executeUpdate("delete from meeting where id in("+meetingids+")");
					rs.executeUpdate("delete from Meeting_Member2 where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from Meeting_ShareDetail where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from Meeting_View_Status where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from Meeting_Topic where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from Meeting_TopicDoc where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from Meeting_Service_New where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from meeting_sign where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from Meeting_Decision where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from meeting_docshare where meetingid in("+meetingids+")");
					rs.executeUpdate("delete from Exchange_Info where type_n='MP' and sortid in("+meetingids+")");
				}
			}
			rs.writeLog("����ɾ���������ݽӿڽ���");
			out.print("����ɾ������");
		} catch (Exception e) {
			rs.writeLog("����ɾ���������ݽӿ��쳣��");
			rs.writeLog("�쳣��Ϣ��"+e.getMessage());
		}

}

%>